package com.bckj.freshnow.payment.pay;

import lombok.Getter;
import lombok.Setter;

public abstract class PaymentService {
    protected String appId;
    @Setter
    @Getter
    private PaymentConfig paymentConfig;

    protected volatile Object service;

    public PaymentService(String appId) {
        this.appId = appId;
    }

    protected abstract void init();

    protected void refresh() {

    }

    public Object getService() {
        if (service == null) {
            synchronized (this) {
                if (service == null) {
                    init();
                }
            }
        }
        return service;
    }
}
